package doan.chuyennganh.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

  private static final String DATABASE_NAME = "doanchuyennghanhtest123.db";
  public  int DATABASE_VERSION = 1;
  public String CREATE_TABLE_QUERY;
  public String TABLE_NAME;
  //private Context context;
  
  public DatabaseHelper(Context context , String tableName, String createTableQuery,int dbVersion) {
    super(context, DATABASE_NAME, null, dbVersion);
    //this.context = context;
    TABLE_NAME = tableName;
    CREATE_TABLE_QUERY = createTableQuery;
    DATABASE_VERSION = dbVersion;
  }
  
  @Override
  public void onCreate(SQLiteDatabase database) {
    database.execSQL(CREATE_TABLE_QUERY);
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//    Log.w(DatabaseHelper.class.getName(),
//        "Upgrading database from version " + oldVersion + " to "
//            + newVersion + ", which will destroy all old data");
//    db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
    onCreate(db);
  }
}
